		TITLE	SYMC -

		INCLUDE	MACROS
		INCLUDE	SYMBOLS

;
;	__asepfsc	== start address
;	__aclkfsc	== public
;

		PUBLIC	PERFORM_VERIFY_A,PERFORM_VERIFY_B,VERIFY_FAIL

		.DATA

	SOFT	EXTW	SYMBOL_LENGTH,ERR_COUNT

	SOFT	EXTQ	SYMBOL_TPTR,SYMBOL_GARRAY

	SOFT	EXTCA	OPTI_MOVE

		.CODE	MIDDLE_TEXT

	SOFT	EXTP	FAR_INSTALL,ERR_ABORT,AX_MESOUT

	SOFT	EXTA	CANNOT_LINK_ERR

		ASSUME	DS:NOTHING

PERFORM_VERIFY_A	PROC
		;
		;LOOK FOR SEGMENTS AND SYMBOLS
		;
		LEA	SI,@___aclkfsc
		CALL	FIND_SYMBOL
		MOV	SYMC_SYM1,AX
		LEA	SI,@___asepfsc
		CALL	FIND_SYMBOL
		MOV	SYMC_START,AX
8$:
;		LEA	SI,@_RCL_GROUP
;		CALL	VERIFY_GROUP
		RET

PERFORM_VERIFY_A	ENDP

PERFORM_VERIFY_B	PROC
		;
		;
		;
		BITT	COMENT_FOUND
		JZ	9$
		MOV	AX,SYMC_SYM1
		CALL	VERIFY_SYMBOL
		MOV	AX,SYMC_START
		CALL	VERIFY_SYMBOL
		RET

9$:
		JMP	VERIFY_FAIL

PERFORM_VERIFY_B	ENDP

if 0
VERIFY_SEGMENT	PROC	NEAR
		;
		;
		;
		LEA	SI,CLASS1
		CALL	VERIFY_CLASS
		MOV	DS,AX
		SYM_CONV_DS
		PUSH	[BX]._C_CLASS_NUMBER
if	fg_os2
		PUSH	SS
else
		PUSH	CS
endif
		POP	DS
		LEA	SI,SEG1
		CALL	UNXOR
		FIXES
		GET_NAME_HASH
		LNAME_INSTALL
		POP	CX
		ADD	CX,RECTYP_SEGMENT
		CALL	SEARCH_RAINBOW_AXBX
		JC	VERIFY_FAIL
		RET

VERIFY_SEGMENT	ENDP

VERIFY_CLASS	PROC	NEAR
		;
		;
		;
if	fg_os2
		PUSH	SS
else
		PUSH	CS
endif
		POP	DS
		CALL	UNXOR
		FIXES
		GET_NAME_HASH
		LNAME_INSTALL
		MOV	CX,RECTYP_CLASS
		CALL	SEARCH_RAINBOW_AXBX
		JC	VERIFY_FAIL
		RET

VERIFY_CLASS	ENDP

endif

VERIFY_FAIL:
		CMP	ERR_COUNT,0
		JNZ	VF_5
		MOV	AX,SEG CALL_SLR
		MOV	SI,OFF CALL_SLR
		CALL	AX_MESOUT
VF_5:
		MOV	CL,CANNOT_LINK_ERR
		CALL	ERR_ABORT

VERIFY_SYMBOL	PROC	NEAR
		;
		;ALSO FAIL IF NOT DEFINED, I.E., FAIL IF NSYM_UNDEFINED, NSYM_LIBRARY, NSYM_EXTERNAL, NSYM_ALIASED, NSYM_ALIASED_UNREF
		;
		OR	AX,AX
		JZ	VERIFY_FAIL
		CONVERT_GINDEX_AX_DSSI	SYMBOL_GARRAY
		MOV	AL,DS:[SI]._S_NSYM_TYPE
		CMP	AL,NSYM_CONST
		JZ	9$
		CMP	AL,NSYM_RELOC
		JNZ	VERIFY_FAIL
9$:
		RET

VERIFY_SYMBOL	ENDP

FIND_SYMBOL	PROC	NEAR
		;
		;
		;
		PUSH	SS
		POP	DS
		CALL	UNXOR
		FIXES
		GET_NAME_HASH
		CALL	FAR_INSTALL
		RET

FIND_SYMBOL	ENDP

if	0

VERIFY_GROUP	PROC	NEAR
		;
		;
		;
if	fg_os2
		PUSH	SS
else
		PUSH	CS
endif
		POP	DS
		CALL	UNXOR
		FIXES
		GET_NAME_HASH
		LNAME_INSTALL
		MOV	CX,RECTYP_GROUP
		CALL	SEARCH_RAINBOW_AXBX
		JC	VERIFY_FAIL
		RET

VERIFY_GROUP	ENDP

endif

UNXOR		PROC	NEAR
		;
		;
		;
		PUSH	SI
		MOV	AH,0AAH
		XOR	BPTR [SI],AH
		LODSB
		MOV	CL,AL
		XOR	CH,CH
1$:
		XOR	BPTR [SI],AH
		INC	SI
		LOOP	1$
		POP	SI
		RET

UNXOR		ENDP

GENSTRING	MACRO	XX
		LOCAL	LEN

@_&XX		DB	LEN XOR 0AAH
		IRPC	XXX,<XX>
		DB	'&XXX' XOR 0AAH
		ENDM

LEN		EQU	$-1-@_&XX

		ENDM

		.DATA

		GENSTRING	__aclkfsc
		GENSTRING	__asepfsc
;CLASS1		LABEL	BYTE
;		GENSTRING	<CODE>
;SEG1		LABEL	BYTE
;		GENSTRING	RCLEP_TEXT

		.CODE	MIDDLE_TEXT

CALL_SLR	DB	LENGTH CALL_SLR-1,'Cannot link with this version of OPTLINK.',0dh,0ah,\
'Contact SLR Systems, Inc at (412)282-0864 for other OPTLINK versions.',0dh,0ah, \
'Or write:',0dh,0ah, \
'  1622 N. Main St.',0dh,0ah, \
'  Butler, PA  16001',0dh,0ah

		.DATA

		PUBLIC	SYMC_START,SYMC_SYM1

SYMC_START	DW	?
SYMC_SYM1	DW	?

		END

